#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    int x;
    cin>>x;
    int a[3]={0};
    int y=0,ans=0;
    while(a[0]!=x||a[1]!=x||a[2]!=x)
    {
        a[y%3]=min(x,a[(y+1)%3]*2+1);
        y++;
        //cout<<a[(y-1)%3]<<endl;
    }
    cout<<y<<endl;
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T=1;
    cin>>T;
    while(T--)
    {
       solve();
    }
    return 0;
}